﻿@model ScrumProject.Models.Members

@{
    ViewBag.Title = "AddUser";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>AddUser</h2>


<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Project</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.UserId, "User")
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(m => m.UserId, new SelectList(new ScrumProject.Models.UserRepository().GetAllUsers(), "Id", "Username"))
            @*Html.DropDownList(ViewBag.Users, "UserId")*@
            @Html.ValidationMessageFor(model => model.UserId)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Role, "Roles")
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(m => m.Role, new SelectList(new ScrumProject.ViewModels.ProjectRolesViewModel().GetProjectRoles(), "Id", "Role"))
            @Html.ValidationMessageFor(model => model.Role)
        </div>

        <p>
            <input type="submit" value="Add User" class="btn" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to project edit", "Edit", new { projectId = Model.ProjectId },null)
</div>
